;; Compile Options : /TM610409 /MS /near /Imain /Iclk /IINTERR~1 /Ikey /Ilcd /Ilcdshow /Imelody /Ircadc /Itemphum /Itimers /IMACROA~1 /Ieternity /ICLKbuzz /SD /Om /W 1 /Fa_output\_obj\ 
;; Version Number  : Ver.3.54.3
;; File Name       : melody.c

	type (M610409) 
	model small, near
	$$MD0_CON$melody segment code 2h #0h
	$$MD0_LEN_buzz$melody segment code 2h #0h
	$$MD0_LEN_melody$melody segment code 2h #0h
	$$MD0_TMP_buzz$melody segment code 2h #0h
	$$MD0_TMP_melody$melody segment code 2h #0h
	$$MD0_TON_buzz$melody segment code 2h #0h
	$$MD0_TON_melody$melody segment code 2h #0h
	$$TABRCADC_SAMPLING_MODE$melody segment table 2h #0h
CVERSION 3.54.3
CGLOBAL 01H 03H 0000H "MD0_TON_melody" 08H 02H 05H 00H 80H 00H 00H 00H 01H
CGLOBAL 01H 03H 0000H "MD0_CON" 08H 02H 00H 00H 80H 04H 00H 00H 01H
CGLOBAL 01H 03H 0000H "MD0_TMP_buzz" 08H 02H 01H 00H 80H 00H 00H 00H 01H
CGLOBAL 01H 03H 0000H "MD0_TON_buzz" 08H 02H 02H 00H 80H 00H 00H 00H 01H
CGLOBAL 01H 03H 0000H "MD0_LEN_melody" 08H 02H 06H 00H 80H 00H 00H 00H 01H
CGLOBAL 01H 03H 0000H "MD0_LEN_buzz" 08H 02H 03H 00H 80H 00H 00H 00H 01H
CGLOBAL 01H 03H 0000H "MD0_TMP_melody" 08H 02H 04H 00H 80H 00H 00H 00H 01H
CSTRUCTTAG 0000H 0000H 0000H 0008H 00000001H "_Notag"
CSTRUCTMEM 52H 00000001H 00000000H "b0" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000001H "b1" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000002H "b2" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000003H "b3" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000004H "b4" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000005H "b5" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000006H "b6" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000007H "b7" 02H 00H 00H
CENUMTAG 0000H 0000H 0001H 0010H "BUZZmode_value"
CENUMMEM 00000000H "buzz_one"
CENUMMEM 00000001H "buzz_two"
CENUMMEM 00000002H "buzz_three"
CENUMMEM 00000003H "buzz_four"
CENUMMEM 00000004H "buzz_five"
CENUMMEM 00000005H "buzz_six"
CENUMMEM 00000006H "buzz_seven"
CENUMMEM 00000007H "buzz_eight"
CENUMMEM 00000008H "buzz_nine"
CENUMMEM 00000009H "buzz_ten"
CENUMMEM 0000000AH "buzz_eleven"
CENUMMEM 0000000BH "buzz_twelve"
CENUMMEM 0000000CH "buzz_thirteen"
CENUMMEM 0000000DH "buzz_fourteen"
CENUMMEM 0000000EH "buzz_fifteen"
CENUMMEM 0000000FH "buzz_sixteen"
CTYPEDEF 0000H 0000H 42H "uint8" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "DWORD" 02H 00H 02H
CTYPEDEF 0000H 0000H 43H "INT8" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "uint32" 02H 00H 02H
CTYPEDEF 0000H 0000H 42H "uint16" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "byte" 02H 00H 00H
CTYPEDEF 0000H 0000H 43H "INT32" 02H 00H 02H
CTYPEDEF 0000H 0000H 43H "INT16" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "dword" 02H 00H 02H
CTYPEDEF 0000H 0000H 43H "int8" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "UINT" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "WORD" 02H 00H 01H
CTYPEDEF 0000H 0000H 43H "int16" 02H 00H 01H
CTYPEDEF 0000H 0000H 43H "int32" 02H 00H 02H
CTYPEDEF 0000H 0000H 42H "UINT8" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "uint" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "uchar" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "UINT16" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "UINT32" 02H 00H 02H
CTYPEDEF 0000H 0000H 42H "word" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "BOOL" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "BYTE" 02H 00H 00H
CTYPEDEF 0000H 0000H 43H "_BYTE_FIELD" 04H 00H 05H 00H 00H
CSGLOBAL 00H 0010H "RCADC_SAMPLING_MODE" 05H 01H 10H 00H 00H 00H
CFILE 0001H 00000822H "E:\\IDEU8\\Inc\\m610409.h"
CFILE 0002H 0000003AH "melody\\melody.h"
CFILE 0003H 00000025H "MACROA~1\\MacroAndConst.h"
CFILE 0000H 00000097H "melody\\melody.c"

	rseg $$MD0_CON$melody
CFUNCTION 0

_MD0_CON	:
CBLOCK 0 1 16

;; {
CLINEA 0000H 0001H 0010H 0002H 0002H
	push	xr8
	mov	er8,	er0
	mov	er10,	er2
CBLOCK 0 2 16
CARGUMENT 46H 0002H 0028H "M0_RUN" 02H 00H 01H
CARGUMENT 46H 0002H 0029H "BZ_MD" 02H 00H 01H

;;  if((M0_RUN > MELODY_HIGH) || (BZ_MD > MELODY_HIGH)) {
CLINEA 0000H 0001H 0011H 0003H 0037H
	cmp	r0,	#01h
	cmpc	r1,	#00h
	bgt	_$L2
	cmp	r2,	#01h
	cmpc	r3,	#00h
	ble	_$L1
_$L2 :
CBLOCK 0 3 17

;;   return (MELODY_DEPLOY_FAIL);	
CLINEA 0000H 0001H 0012H 0004H 0020H
	mov	er0,	#-1
CBLOCKEND 0 3 19
CBLOCKEND 0 2 23

;;  }
CLINEA 0000H 0001H 0017H 0003H 0003H
_$L0 :
	pop	xr8
	rt

;;   }
CLINEA 0000H 0000H 0013H 0004H 0004H
_$L1 :

;;   M0RUN = M0_RUN;
CLINEA 0000H 0001H 0014H 0004H 0012H
	mov	r0,	r8
	and	r0,	#01h
	beq	_$M1
	sb	0f2c0h.0
	bal	_$M2
_$M1 :
	rb	0f2c0h.0
_$M2 :

;;   BZMD = BZ_MD;
CLINEA 0000H 0001H 0015H 0004H 0010H
	mov	r0,	r10
	and	r0,	#01h
	beq	_$M3
	sb	0f2c0h.1
	bal	_$M4
_$M3 :
	rb	0f2c0h.1
_$M4 :

;;   return (MELODY_DEPLOY_OK);
CLINEA 0000H 0001H 0016H 0004H 001DH
	mov	er0,	#0 
	bal	_$L0
CBLOCKEND 0 1 23
CFUNCTIONEND 0


	rseg $$MD0_TMP_buzz$melody
CFUNCTION 1

_MD0_TMP_buzz	:
CBLOCK 1 1 37

;; {
CLINEA 0000H 0001H 0025H 0002H 0002H
CBLOCK 1 2 37
CARGUMENT 46H 0002H 0024H "MD0_TMP" 02H 00H 01H

;;  if(MD0_TMP >= buzzTMP_mode) {
CLINEA 0000H 0001H 0026H 0003H 001FH
	cmp	r0,	#04h
	cmpc	r1,	#00h
	blt	_$L9
CBLOCK 1 3 38

;;   return (MELODY_DEPLOY_FAIL);	
CLINEA 0000H 0001H 0027H 0004H 0020H
	mov	er0,	#-1
CBLOCKEND 1 3 40
CBLOCKEND 1 2 43

;;  }
CLINEA 0000H 0001H 002BH 0003H 0003H
	rt

;;   }
CLINEA 0000H 0000H 0028H 0004H 0004H
_$L9 :

;;   MD0TMP = RCADC_SAMPLING_MODE[MD0_TMP]; 
CLINEA 0000H 0001H 0029H 0004H 002AH
	l	r0,	NEAR _RCADC_SAMPLING_MODE[er0]
	st	r0,	0f2c1h

;;   return (MELODY_DEPLOY_OK);
CLINEA 0000H 0001H 002AH 0004H 001DH
	mov	er0,	#0 
	rt
CBLOCKEND 1 1 43
CFUNCTIONEND 1


	rseg $$MD0_TON_buzz$melody
CFUNCTION 2

_MD0_TON_buzz	:
CBLOCK 2 1 62

;; {
CLINEA 0000H 0001H 003EH 0002H 0002H
CBLOCK 2 2 62
CARGUMENT 46H 0002H 0024H "MD0_TON" 02H 00H 01H

;;  if(MD0_TON >= buzzTON_mode) {
CLINEA 0000H 0001H 003FH 0003H 001FH
	cmp	r0,	#08h
	cmpc	r1,	#00h
	blt	_$L12
CBLOCK 2 3 63

;;   return (MELODY_DEPLOY_FAIL);	
CLINEA 0000H 0001H 0040H 0004H 0020H
	mov	er0,	#-1
CBLOCKEND 2 3 65
CBLOCKEND 2 2 68

;;  }
CLINEA 0000H 0001H 0044H 0003H 0003H
	rt

;;   }
CLINEA 0000H 0000H 0041H 0004H 0004H
_$L12 :

;;   MD0TON = RCADC_SAMPLING_MODE[MD0_TON]; 
CLINEA 0000H 0001H 0042H 0004H 002AH
	l	r0,	NEAR _RCADC_SAMPLING_MODE[er0]
	st	r0,	0f2c2h

;;   return (MELODY_DEPLOY_OK);
CLINEA 0000H 0001H 0043H 0004H 001DH
	mov	er0,	#0 
	rt
CBLOCKEND 2 1 68
CFUNCTIONEND 2


	rseg $$MD0_LEN_buzz$melody
CFUNCTION 3

_MD0_LEN_buzz	:
CBLOCK 3 1 94

;; {
CLINEA 0000H 0001H 005EH 0002H 0002H
CBLOCK 3 2 94
CARGUMENT 46H 0002H 0024H "MD0_LEN" 02H 00H 01H

;;  if(MD0_LEN >= buzzLEN_mode) {
CLINEA 0000H 0001H 005FH 0003H 001FH
	cmp	r0,	#010h
	cmpc	r1,	#00h
	blt	_$L15
CBLOCK 3 3 95

;;   return (MELODY_DEPLOY_FAIL);	
CLINEA 0000H 0001H 0060H 0004H 0020H
	mov	er0,	#-1
CBLOCKEND 3 3 97
CBLOCKEND 3 2 100

;;  }
CLINEA 0000H 0001H 0064H 0003H 0003H
	rt

;;   }
CLINEA 0000H 0000H 0061H 0004H 0004H
_$L15 :

;;   MD0LEN = RCADC_SAMPLING_MODE[MD0_LEN]; 
CLINEA 0000H 0001H 0062H 0004H 002AH
	l	r0,	NEAR _RCADC_SAMPLING_MODE[er0]
	st	r0,	0f2c3h

;;   return (MELODY_DEPLOY_OK);
CLINEA 0000H 0001H 0063H 0004H 001DH
	mov	er0,	#0 
	rt
CBLOCKEND 3 1 100
CFUNCTIONEND 3


	rseg $$MD0_TMP_melody$melody
CFUNCTION 4

_MD0_TMP_melody	:
CBLOCK 4 1 111

;; {
CLINEA 0000H 0001H 006FH 0002H 0002H
CBLOCK 4 2 111
CARGUMENT 46H 0002H 0024H "MD0_TMP" 02H 00H 01H

;;  if(MD0_TMP >= melodyTMP_mode) {
CLINEA 0000H 0001H 0070H 0003H 0021H
	cmp	r0,	#010h
	cmpc	r1,	#00h
	blt	_$L18
CBLOCK 4 3 112

;;   return (MELODY_DEPLOY_FAIL);	
CLINEA 0000H 0001H 0071H 0004H 0020H
	mov	er0,	#-1
CBLOCKEND 4 3 114
CBLOCKEND 4 2 117

;;  }
CLINEA 0000H 0001H 0075H 0003H 0003H
	rt

;;   }
CLINEA 0000H 0000H 0072H 0004H 0004H
_$L18 :

;;   MD0TMP = RCADC_SAMPLING_MODE[MD0_TMP]; 
CLINEA 0000H 0001H 0073H 0004H 002AH
	l	r0,	NEAR _RCADC_SAMPLING_MODE[er0]
	st	r0,	0f2c1h

;;   return (MELODY_DEPLOY_OK);
CLINEA 0000H 0001H 0074H 0004H 001DH
	mov	er0,	#0 
	rt
CBLOCKEND 4 1 117
CFUNCTIONEND 4


	rseg $$MD0_TON_melody$melody
CFUNCTION 5

_MD0_TON_melody	:
CBLOCK 5 1 127

;; {
CLINEA 0000H 0001H 007FH 0002H 0002H
CBLOCK 5 2 127
CARGUMENT 46H 0001H 0014H "MD0_TON" 02H 00H 00H

;;  	 (MD0_TON <= (unsigned char)melodyTON_mode_MAX)) {
CLINEA 0000H 0000H 0081H 0005H 0035H
CBLOCK 5 3 129

;;   return (MELODY_DEPLOY_FAIL);	
CLINEA 0000H 0001H 0082H 0004H 0020H
	mov	er0,	#-1
CBLOCKEND 5 3 131
CBLOCKEND 5 2 134

;;  }
CLINEA 0000H 0001H 0086H 0003H 0003H
	rt

;;   return (MELODY_DEPLOY_OK);
CBLOCKEND 5 1 134
CFUNCTIONEND 5


	rseg $$MD0_LEN_melody$melody
CFUNCTION 6

_MD0_LEN_melody	:
CBLOCK 6 1 144

;; {
CLINEA 0000H 0001H 0090H 0002H 0002H
CBLOCK 6 2 144
CARGUMENT 46H 0001H 0014H "MD0_LEN" 02H 00H 00H

;;  	 (MD0_LEN <= (unsigned char)melodyLEN_mode_MAX)) {
CLINEA 0000H 0000H 0092H 0005H 0035H
CBLOCK 6 3 146

;;   return (MELODY_DEPLOY_FAIL);	
CLINEA 0000H 0001H 0093H 0004H 0020H
	mov	er0,	#-1
CBLOCKEND 6 3 148
CBLOCKEND 6 2 151

;;  }
CLINEA 0000H 0001H 0097H 0003H 0003H
	rt

;;   return (MELODY_DEPLOY_OK);
CBLOCKEND 6 1 151
CFUNCTIONEND 6

	public _MD0_TON_melody
	public _MD0_CON
	public _MD0_TMP_buzz
	public _MD0_TON_buzz
	public _MD0_LEN_melody
	public _MD0_LEN_buzz
	public _MD0_TMP_melody
	extrn code near : _main

	rseg $$TABRCADC_SAMPLING_MODE$melody
_RCADC_SAMPLING_MODE :
	db	00h
	db	01h
	db	02h
	db	03h
	db	04h
	db	05h
	db	06h
	db	07h
	db	08h
	db	09h
	db	0ah
	db	0bh
	db	0ch
	db	0dh
	db	0eh
	db	0fh

	end
